	//时间转换器
	Date.prototype.format = function(fmt) {
        var o = {
            "M+" : this.getMonth() + 1, //月份 
            "d+" : this.getDate(), //日 
            "h+" : this.getHours(), //小时 
            "m+" : this.getMinutes(), //分 
            "s+" : this.getSeconds(), //秒 
            "q+" : Math.floor((this.getMonth() + 3) / 3), //季度 
            "S" : this.getMilliseconds()
        //毫秒 
        };
        if (/(y+)/.test(fmt))
            fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "")
                    .substr(4 - RegExp.$1.length));
        for ( var k in o)
            if (new RegExp("(" + k + ")").test(fmt))
                fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k])
                        : (("00" + o[k]).substr(("" + o[k]).length)));
        return fmt;
    }; 
	
	$(function(){
		var content=1;
		var pageNo=1;
		$.ajax({
			url:"student/countScore.do",
			type:"POST",
			dataType:"JSON",
			data:{
				pageNo:pageNo,
				content:content
			},
			success:function(exams){
				$.each(exams,function(i){
					if(i=="exam"){
						$(".b").remove();
						$.each(exams[i],function(j){
							var s="<tr class='tr-style b'>";
							s+="<td>"+exams[i][j].examTypeName+"</td>";
							s+="<td>"+exams[i][j].courseName+"</td>";
							var day = new Date(exams[i][j].examStartTime).format("yyyy-MM-dd hh:mm");
							s+="<td>"+day+"</td>";
							s+="<td>"+exams[i][j].stuScore+"</td>";
							$("#tb").append(s);
						});
					}
				});
				$(".cc").empty();
				if(exams.pages>1){
					var s="";
					if(exams.pageNo>1){
						s+="<a onclick='countScore("+(pageNo-1),content+")'>上一页&nbsp;&nbsp;</a>";
					}
					for(var n=0;n<obj.pages;n++){
						if(exams.pageNo==(n+1)){
							s+="<span style='font-size:16px;color:#446ee6;'>&nbsp;&nbsp;"+(n+1)+"&nbsp;&nbsp;</span>";
						}
						if(exams.pageNo!=(n+1)){
							s+="<a onclick='countScore("+(n+1),content+")'>"+(n+1)+"</a>";
						}
					}
					if(exams.pageNo<obj.pages){
						s+="<a onclick='countScore("+(pageNo+1),content+")'>&nbsp;&nbsp;下一页</a>";
					}
					$(".cc").append(s);
				}
			},
			error:function(error){
		         $(".login-box-warning").text("error:"+error);
			}
		});
	});
	
	function countScore(num,con){
		var content=con;
		var pageNo=num;
		$.ajax({
			url:"student/countScore.do",
			type:"POST",
			dataType:"JSON",
			data:{
				pageNo:pageNo,
				content:content
			},
			success:function(exams){
				$.each(exams,function(i){
					if(i=="exam"){
						$(".b").remove();
						$.each(exams[i],function(j){
							var s="<tr class='tr-style b'>";
							s+="<td>"+exams[i][j].examTypeName+"</td>";
							s+="<td>"+exams[i][j].courseName+"</td>";
							var day = new Date(exams[i][j].examStartTime).format("yyyy-MM-dd hh:mm");
							s+="<td>"+day+"</td>";
							s+="<td>"+exams[i][j].stuScore+"</td>";
							$("#tb").append(s);
						});
					}
				});
				$(".cc").empty();
				if(exams.pages>1){
					var s="";
					if(exams.pageNo>1){
						s+="<a onclick='countScore("+(pageNo-1),content+")'>上一页&nbsp;&nbsp;</a>";
					}
					for(var n=0;n<obj.pages;n++){
						if(exams.pageNo==(n+1)){
							s+="<span style='font-size:16px;color:#446ee6;'>&nbsp;&nbsp;"+(n+1)+"&nbsp;&nbsp;</span>";
						}
						if(exams.pageNo!=(n+1)){
							s+="<a onclick='countScore("+(n+1),content+")'>"+(n+1)+"</a>";
						}
					}
					if(exams.pageNo<obj.pages){
						s+="<a onclick='countScore("+(pageNo+1),content+")'>&nbsp;&nbsp;下一页</a>";
					}
					$(".cc").append(s);
				}
			},
			error:function(error){
		         $(".login-box-warning").text("error:"+error);
			}
		});
	}